#ifndef __WIZ_BNF_PARSER_ABSTRACT_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_PARSER_ABSTRACT_HPP__SHANHAOBO_19800429__

#include "../WizBNFMatch.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Parser
        {
            namespace Abstract
            {
                template <typename ScannerT, typename AttributeT>
                struct Type
                {
                    Type() {}
                    virtual ~Type() {}

                    virtual typename ::Wiz::BNF::Match::Result<ScannerT, AttributeT>::tType
                        DoParse(ScannerT const& Scan) const = 0;
                    virtual Type* Clone() const = 0;
                };
            } /// end of namespace Abstract

            namespace Concrete
            {
                template <typename ParserT, typename ScannerT, typename AttributeT>
                struct Type : public ::Wiz::BNF::Parser::Abstract::Type<ScannerT, AttributeT>
                {
                    Type(ParserT const& Prsr) : m_Parser(Prsr)
                    {}

                    virtual ~Type()
                    {}

                    virtual typename ::Wiz::BNF::Match::Result<ScannerT, AttributeT>::tType
                    DoParse(ScannerT const& Scan) const
                    {
                        return m_Parser.Parse(Scan);
                    }

                    virtual Type* Clone() const
                    {
                        return new ::Wiz::BNF::Parser::Concrete::Type<ParserT, ScannerT, AttributeT>(m_Parser);
                    }

                    typedef typename ParserT::tEmbedded tEmbeddedParser;
                    tEmbeddedParser m_Parser;
                };
            } /// end of namespace Concrete
        } /// end of namespace Parser
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_PARSER_ABSTRACT_HPP__SHANHAOBO_19800429__*/
